﻿<Window x:Class="Cjc.ThreeDeemium.ChildWindow"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:cjc="clr-namespace:Cjc.ChromiumBrowser;assembly=Cjc.ChromiumBrowser"
	xmlns:effect="clr-namespace:ShaderEffectLibrary" ResizeMode="CanResizeWithGrip"
	Title="WPM Chromium Browser Child Window" Width="900" Height="600" Name="window"
	AllowsTransparency="True" Background="Transparent" WindowStyle="None">

	<Window.Resources>
		<Style TargetType="{x:Type ResizeGrip}">
			<Setter Property="Margin" Value="5"/>
		</Style>
	</Window.Resources>

	<Grid Margin="5">

		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<Grid Grid.Row="1">
			<Border Grid.Row="1" BorderBrush="Blue" BorderThickness="1"
					RenderTransformOrigin="0.5,0.5" Background="#C0FFFFFF" >
				<Border.LayoutTransform>
					<RotateTransform Angle="{Binding Value, ElementName=angle}"/>
				</Border.LayoutTransform>
				<cjc:WebBrowser Name="browser" IsTransparent="True" EnableAsyncRendering="False"
						TabIndex="2" Focusable="True"
						Effect="{Binding SelectedItem.Value, ElementName=effects}">
				</cjc:WebBrowser>
			</Border>
			<Grid.Effect>
				<DropShadowEffect Opacity="0.5"/>
			</Grid.Effect>
		</Grid>

		<Border Grid.Row="0" Background="#C0FFFFFF" CornerRadius="10" BorderBrush="Blue" BorderThickness="1" Margin="0,0,0,5" MouseLeftButtonDown="Border_MouseLeftButtonDown" >
			<Grid Focusable="False">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition/>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition Width="Auto"/>
				</Grid.ColumnDefinitions>
				<Button Grid.Column="0" Name="back" Content="&lt;" VerticalAlignment="Center"
					Margin="5,0,0,0" Click="back_Click"/>
				<Button Grid.Column="1" Name="forward" Content="&gt;" VerticalAlignment="Center"
					Margin="2,0,0,0" Click="forward_Click"/>
				<TextBlock Grid.Column="2" Text="Address" Margin="5" VerticalAlignment="Center" Focusable="False"/>
				<TextBox Name="address" Grid.Column="3" Margin="0,5,0,5" VerticalAlignment="Center"
					 Text="{Binding Source, Mode=OneWay, ElementName=browser}" TabIndex="0" />
				<Button Grid.Column="4" Content="Go" Margin="5" Click="Button_Click" VerticalAlignment="Center"
					TabIndex="1" Focusable="True" IsDefault="{Binding IsKeyboardFocused, ElementName=address}"/>
				<Button Name="close" Grid.Column="5" Content="Close" VerticalAlignment="Center"
					Margin="0,0,5,0" Click="close_Click"/>
			</Grid>
			<Border.Effect>
				<DropShadowEffect Opacity="0.5"/>
			</Border.Effect>
		</Border>

		<Border Grid.Row="2" Background="#C0FFFFFF" CornerRadius="10,10,0,10" BorderBrush="Blue" BorderThickness="1" Margin="0,5,0,0">
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition />
					<ColumnDefinition Width="Auto" />
				</Grid.ColumnDefinitions>
				<Slider Grid.Column="0" Name="angle" Minimum="-180" Maximum="180" VerticalAlignment="Center"
						Focusable="False" Margin="5,5,0,5" />
				<ComboBox Grid.Column="1" VerticalAlignment="Center" Name="effects" Margin="5,5,15,5" SelectedIndex="0"
					  ItemsSource="{Binding Effects, ElementName=window}" DisplayMemberPath="Key" SelectedValuePath="Value"/>
			</Grid>
			<Border.Effect>
				<DropShadowEffect Opacity="0.5"/>
			</Border.Effect>
		</Border>

	</Grid>

</Window>